package top.superflow.flow.runtime.process

import java.lang.reflect.Method

import top.superflow.exception.RequestUnsupportedException
import top.superflow.flow.runtime.processprovider.RuntimeProcessProvider

class InnerSpringExtProcess extends ExtProcess{

  private var method : Method = _


  def setMethod(value : Method) = method = value

  override def fillResponse(result: Any, response: ProcessResponse): Unit = {
    response.setResponse(result)
  }

  override def setProvider(p: RuntimeProcessProvider): Unit = {
    if(p == null){
      throw new RequestUnsupportedException("The dependency configuration should not be null.")
    }

    super.setProvider(p)
  }

}

object InnerSpringExtProcess{


  def main(args: Array[String]): Unit = {
    val t = new InnerSpringExtProcess
    val ps = List("aaa", "bbb")

    for(m <- classOf[InnerSpringExtProcess].getMethods){
      println(m.getName)
    }
    print(classOf[InnerSpringExtProcess].getMethod("test", classOf[Any], classOf[Any]).invoke(t,  ps.toArray:_*))
  }
}
